<template>
  <!-- 生产单信息 -->
  <div id="produceOrderDetail">
    <el-form :model="form" label-width="100">
      <!-- <el-form-item label="生产单号:">
        <p>{{ form.number }}</p>
      </el-form-item>
      <el-form-item label="生产单名称:">
        <p>{{ form.name }}</p>
      </el-form-item> -->
      <el-form-item label="合同:">
        <p @click="toContractDetail()" class="click">{{ form.contractName }}</p>
        <p style="color: red" v-if="form.source">（退货重做单）</p>
      </el-form-item>
      <!-- <el-form-item label="生产数量:">
        <p>{{ form.quantity }}</p>
      </el-form-item> -->
      <el-form-item label="生产状态:">
        <p>{{ form.typeName }}</p>
      </el-form-item>
      <el-form-item label="负责人:">
        <p>{{ form.responsibleName }}</p>
      </el-form-item>
      <el-form-item label="生产截止时间:">
        <p>{{ form.endTime }}</p>
      </el-form-item>
      <el-form-item label="交货时间:">
        <p>{{ form.deliveryTime }}</p>
      </el-form-item>
      <el-form-item label="备注:">
        <p>{{ form.remark }}</p>
      </el-form-item>
      <el-form-item label="附件:" style="width: 100%">
        <other-files ref="otherFiles" :files="form.otherFileList"></other-files>
      </el-form-item>
      <el-form-item label="合同附件:" style="width: 100%">
        <other-files ref="otherFiles" :files="contractOtherFile"></other-files>
      </el-form-item>
      <!-- <el-form-item label="审核状态:" v-if="isReloadData" style="width: 100%">
        <p v-if="form.status == 0" style="color: #e6a23c">待审核</p>
        <p v-if="form.status == 1" style="color: #67c23a">通过</p>
        <p v-if="form.status == 2" style="color: #f56c6c">未通过</p>
      </el-form-item> -->
      <el-form-item label="创建时间:">
        <p>{{ form.createTime }}</p>
      </el-form-item>
      <el-form-item label="修改时间:" v-if="form.updateTime">
        <p>{{ form.updateTime }}</p>
      </el-form-item>
    </el-form>
    <!-- <div class="button" v-if="form.type > 0">
      <el-button
        type="primary"
        v-auth-button="['send/produceOrderManagement']"
        @click="deliverGoods"
        >发货</el-button
      >
    </div> -->
  </div>
</template>
<script>
import otherFiles from '@/components/otherFiles'
export default {
  name: 'produceOrderDetail',
  emits: ['updatePage'],
  data () {
    return {
      // form: {},
      followType: [],//跟进类型
      contractOtherFile: [],
      isReloadData: true//局部刷新标识
    }
  },
  components: {
    otherFiles,
  },
  props: {
    form: {
      type: Object,
      required: true,
      default: () => {
        return {}
      }
    },
  },
  mounted () {
    this.getContractOtherFile()
  },
  methods: {
    toContractDetail () {
      console.log(this.form)
      this.$router.push({
        path: "/contract/contractManagement/contractDetail",
        query: {
          id: this.form.contractId,
        },
      })

    },
    // 获取合同附件
    async getContractOtherFile () {
      let res = await this.$API.produce.deliver.getContractOtherFile.get({ produceId: this.$route.query.id })
      this.contractOtherFile = res.data
    },

    // 发货
    deliverGoods () {
      this.$router.push({
        path: '/produce/produceOrderManagement/deliverAdd',
        query: {
          mode: 'add',
          produceId: this.form.id
        }
      })
    },

  }
}
</script>
<style lang='scss' scoped>
.button {
  margin: 10px 0 0 40px;
}
</style>